package net.esj.background.struts2.view;

import java.util.Set;

import net.esj.background.Constants;
import net.esj.background.struts2.view.easyui.AbstractBgAction;
import net.esj.background.support.BgConfigAware;
import net.esj.background.support.BgMenu;
import net.esj.background.support.UserInfoAware;
import net.esj.basic.utils.StringUtils;

/**
 * 后台首页
 * @author Administrator
 *
 */
public class IndexAction extends AbstractBgAction implements Constants,UserInfoAware,BgConfigAware{

	private Set<BgMenu> menus;
	
	@Override
	public String execute() throws Exception {
		//menus = menuManage.getMenus();
		return SUCCESS;
	}
	
	public String top_banner(){
		return SUCCESS;
	}
	
	
	
	public String left_menu(){
		menus = menuManage.getMenus();
		return SUCCESS;
	}
	
	public void right_corner_alert(){
		writeString(menuManage.getLoginMessage());
	}
	
	public String center_main(){
		return SUCCESS;
	}
	
	public String welcome(){
		return SUCCESS;
	}

	public String footer(){
		return SUCCESS;
	}
	
	/**
	 * 右边模块
	 * @return
	 */
	public String right_tools(){
		return SUCCESS;
	}
	
	
	public String user_info(){
		return SUCCESS;
	}
	
	public Set<BgMenu> getMenus() {
		return menus;
	}
	
	public Object getUserInfo() {
		return loginManage.getUserInfo();
	}

	@Override
	public String getUsername() {
		return loginManage.getUsername();
	}

	@Override
	public Boolean getShowUserInfo() {
		return Boolean.valueOf(StringUtils.hasText(portal.getUserInfoHref()));
	}

	@Override
	public String getUserInfoHref() {
		return portal.getUserInfoHref();
	}
	
	public Object getSessionUser(){
		return getUserInfo();
	}
	
	public String getNamespace(){
		return portal.getNamespace();
	}
}
